package com.vooda.util;

import java.util.Random;

/**
 * author: kenny,
 * date: 2017/8/16.
 * version: v1.0.0
 */
public class RandomUtil {

    /**
     * 生成bound位的随机整数
     *
     * @param bound 位数
     * @return code
     */
    public static String generate(int bound) {
        Random random = new Random();
        String code = random.nextInt((int) Math.pow(10, bound)) + "";
        if (code.length() != bound) {
            return generate(bound);
        }
        return code;
    }
}
